package com.zzsy.carosshopprojects.util;

import android.graphics.drawable.GradientDrawable;

import com.yatoooon.screenadaptation.ScreenAdapterTools;

public class ViewBgUtil {
    /**
     * 设置drawable 背景适配
     * @param px
     * @param color
     * @return
     */
    public static GradientDrawable setBg(int px, int color) {
        int roundRadius= ScreenAdapterTools.getInstance().loadCustomAttrValue(px);
        GradientDrawable gd = new GradientDrawable();
        gd.setColor(color);
        gd.setCornerRadius(roundRadius);
        return gd;
    }

    public static GradientDrawable setWidthBg(int px, int wpx, int color, int wcolor) {
        int roundRadius= ScreenAdapterTools.getInstance().loadCustomAttrValue(px);
        int Stroke= ScreenAdapterTools.getInstance().loadCustomAttrValue(wpx);
        GradientDrawable gd = new GradientDrawable();
        gd.setColor(color);
        gd.setCornerRadius(roundRadius);
        gd.setStroke(Stroke, wcolor);
        return gd;
    }
}
